Repository navigation
Remove names and code nothing uses, and review the kit's comments - #99
Merged
Merged
Conversation
Two of the batch's own closures called Complete-PkProcess and Write-PkMessage by name. A .GetNewClosure() block only sees global functions, so a batch failed with "'Complete-PkProcess' is not recognized" when the kit was loaded for one module only. They're captured up front now, like the private helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A worker given the function (-SharedFunctionNames takes it) could set a handler made in its own runspace, which the main thread then ran for every message. Running another runspace's scriptblock can hang or crash PowerShell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It only looked for an abort after its first 200 ms wait, so a program that finished sooner ran to the end and returned normally, and a slower one ran for about 200 ms before it was killed. It now throws before starting the program, unless -IgnoreAbort is given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… GetNewClosure
DelegateCast missed a scriptblock passed to .NET as ({ 1 }), { 1 }.GetNewClosure(),
[scriptblock]{ 1 } and the like, in the call or through a variable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Invoke-PkRunspaceJobs is Invoke-PkRunspaceBatch, and 13 private functions lose their plural names. -MaxConcurrent and -AbortTimeoutSeconds are the only names on every engine: -MaxParallel and -DrainTimeoutSeconds are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # README.md
Initialize-ParallelKit loses -MaxConcurrentProcesses and ThreadPool, and the dispatcher its -AbortPollCallback alias. Code nothing reaches goes too. The stale-types message says "a different version". Two functions declare their output type. The comments are shorter and checked against the code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # ParallelKit.Harness.ps1 # ParallelKit.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleanup for the next major version: old names kept for compatibility, code nothing reaches, and a review of every comment in the kit.
Breaking
Initialize-ParallelKitno longer has-MaxConcurrentProcesses, which did nothing since 3.4, orThreadPoolin its result, which was always$true.-AbortPollCallbackalias of-PollCallbackis gone.Code nothing used
PkStreamReadTask.Run(TextReader), which nothing called, andPkChildProcessJob.Assign(Process), which only the harness did.TypesVersiongoes to 14.-JobFinalizereturned: the dispatcher discards it.Receive-PkWorkerMessage's queue,Write-PkCallbackLoopWarning's context (every caller passes one) andReceive-PkCompletedHandle's result handler (it has a default).Found by reading the whole file, by looking for functions, locals, parameters and C# members with no other reference, and by PSScriptAnalyzer. The "should be unreachable" checks in the dispatcher stay: a callback that overwrites a job's
GroupKeydoes reach them.Fixed
Comments
Complete-PkProcess), one said a case couldn't happen that a secondAssignreaches, one said the process functions use only .NET, andReceive-PkCompletedHandlehad none. The kit's code with comments stripped differs from before only by the changes above.Test-PkCancelRequestedandGet-PkAbortTriggerLabeldeclare[OutputType()].Tests
Initialize-ParallelKit's result has its four fields.Initialize-ParallelKit -MaxConcurrentis refused (it used to match-MaxConcurrentProcesses).Testing/readme-examples/run.ps1andTesting/hosts/check-host.ps1 -NoCtrlCpass on both.🤖 Generated with Claude Code